import { useReactive } from "ahooks";
import { useModel } from "umi";
import { useEffect } from "react";
import compress from "gql-compress";

const useAllPackages = () => {
    const { graphqlFetch } = useModel("global");

    const state = useReactive({
        packagesLoading: false,
        packages: [],
    });

    const loadAllPackages = async () => {
        state.packagesLoading = true;
        // let res = await graphqlFetch({
        //     query,
        //     variables: {},
        // });
        // let commodities = res?.a?.nodes || [];
        let packages = [0, 1, 3, 3, 3, 3, 3]
        state.packages = packages;
        state.packagesLoading = false;
        // return commodities;
    };

    return { ...state, loadAllPackages };
};

//查询套餐基本信息
const query = compress(``);

export default useAllPackages;
